<template>
  <div class="countContent">
    <h1>求和：{{ sum }}</h1>
    <select v-model.number="n">
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
    </select>
    <button @click="add">加</button>
    <button @click="minus">减</button>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

let sum = ref(0);
let n = ref(1);
function add() {
  sum.value += n.value;
}
function minus() {
  sum.value -= n.value;
}
</script>

<style scoped>
.countContent {
  background: #ccc;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  padding: 10px;
}
</style>
